package org.example.day20240814;

import java.util.Scanner;

public class test6 {
    public static void main(String[] args) {
        int[] Str = {7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2};
        char[] arr;
        char[] m = {'1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2'};
        int result = 0;
        Scanner scanner = new Scanner(System.in);
        int num = scanner.nextInt();
        scanner.nextLine();
        for (int k = 0; k < num; k++) {
            String str = scanner.nextLine();
                int sum = 0;
                arr = str.toCharArray();
                for (int i = 0; i < arr.length - 1; i++) {
                    sum += (arr[i] - '0') * Str[i];
                }
                int z = sum % 11;
                char xxx = m[z];
                if (xxx == arr[17]) {
                    result++;
                } else {
                    System.out.println(str);
                }
        }
        if (result == num) {
            System.out.println("All passed");
        }
    }
}
